#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#define LENGTH 100
#define BarackString "Barack Obama="

int main(){
    int fd1,fd2;
	char data[LENGTH];
	char sdata[LENGTH];
    char *BarackStr;
    char *number;
	fd1 = open("test.txt", O_RDWR);
    fd2 = open("result.txt", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
    printf("here!\n");
    if(read(fd1, data, LENGTH) < 0){
        printf("call read() error!\n");
        return -1;
    }
    printf("data = %s\n", data);
    number = strstr(data, BarackStr) + strlen(BarackString);

    close(fd1);
    close(fd2);
    return 0;
}
